package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.entity.CmsUserBalance;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

@Mapper
public interface CmsUserBalanceMapper extends BaseMapper<CmsUserBalance> {

    /**
     * 获取用户余额
     * @param userId
     * @return
     */
    BigDecimal getUserBalance(@Param("userId") Long userId);

    /**
     * 增加用户余额
     * @param userId
     * @param addMoney
     * @return
     */
    int updateAddUserBalance(@Param("userId") Long userId, @Param("addMoney") BigDecimal addMoney);

    /**
     * 减少用户余额
     * @param userId
     * @param subMoney
     * @return
     */
    int updateSubUserBalance(@Param("userId") Long userId, @Param("subMoney") BigDecimal subMoney);

    /**
     * 获取用户冻结金额
     * @param userId
     * @return
     */
    BigDecimal getUserFrozenAmount(@Param("userId") Long userId);

    /**
     * 增加用户冻结金额
     * @param userId
     * @param addMoney
     * @return
     */
    int updateAddUserFrozenAmount(@Param("userId") Long userId, @Param("addMoney") BigDecimal addMoney);

    /**
     * 减少用户冻结金额
     * @param userId
     * @param subMoney
     * @return
     */
    int updateSubUserFrozenAmount(@Param("userId") Long userId, @Param("subMoney") BigDecimal subMoney);

}